﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcContacts.Models;

namespace MvcContacts.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        private IContactRepository _repository;

        public HomeController() : this(new EF_ContactRepository()){}

        public HomeController(IContactRepository repository)
        {
            _repository = repository;
        }

        public ViewResult Index()
        {
            ViewData["Message"] = "Welcome to ASP.NET MVC!";

            return View("Index", _repository.GetAllContacts());
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
